{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#评估线性回归模型"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " 在这个主题中，我们将介绍回归模型拟合数据的效果。上一个主题我们拟合了数据，但是并没太关注拟合的效果。每当拟合工作做完之后，我们应该问的第一个问题就是“拟合的效果如何？”本主题将回答这个问题。\n",
    "\n",
    "<!-- TEASER_END -->"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Getting ready"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们还用上一主题里的`lr`对象和`boston`数据集。`lr`对象已经拟合过数据，现在有许多方法可以用。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression(copy_X=True, fit_intercept=True, n_jobs=1, normalize=False)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn import datasets\n",
    "boston = datasets.load_boston()\n",
    "from sklearn.linear_model import LinearRegression\n",
    "lr = LinearRegression()\n",
    "lr.fit(boston.data, boston.target)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "predictions = lr.predict(boston.data)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##How to do it..."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们可以看到一些简单的量度（metris）和图形。让我们看看上一章的残差图："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAewAAAFsCAYAAAAOmoq4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XucnVV97/HPL+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m4ceNYv349AJde\neikHHXQQEydOZPr06XzjG98YsP4XXngh++67LxMnTuTAAw/k9ttvH7DsQI/ajRs3jl/96ldArSd+\n1llncdxxxzFx4kQOP/zwnn0ADz/8MEcffTR77bUXBx54INdcc03PvhtvvJFDDz2U3XffnWnTpjFv\n3rxNvsdvfvObvOY1r2HmzObO2G1gS9IosSG8nnjiCW655Rbe/va3A/Dkk09y3HHHcd5557Fq1Sq+\n9KUvceKJJ/LMM8/w4osv8olPfIJbbrmF1atX8+Mf/5gZM2Zscuynn36aE088kS984Qs888wzTJ8+\nnbvuuqtnf72ebktLCzfeeCOrV6/m0ksv5ZOf/CT33XffJuUeeeQRLr74Yu69915Wr17NwoULaW1t\n3YJWqbn66qtpb29n1apVvO51r+Ozn/0sAC+++CJHH300p59+Or/5zW+46qqr+PjHP85DDz0EwIQJ\nE7j88st57rnnuPHGG/na177Gddddt9Gx77jjDh5++GFuvfXWLa7nYAxsSRoFMpPZs2czceJEpk2b\nxvTp0/nc5z4HwOWXX86sWbM49thjAZg5cyaHHXYYN954IxHBuHHjeOCBB/jtb39LS0sLBx100CbH\nv+mmm3jjG9/ICSecwPjx45k7dy5TpkzZ6PyDmTVrFvvvvz8A7373uznmmGO48847Nyk3fvx41qxZ\nw7Jly1i3bh3Tpk3jta997Wa3C9T+mDjhhBM47LDDGD9+PKeddhpLly4F4IYbbmD//fdnzpw5jBs3\njhkzZnDCCSf09LKPOOIIDj74YADe9KY3ccopp2w0OgG10YWdd96ZHXfccYvqWY+BLUmjQERw3XXX\nsXr1ajo6Orj99tu59957AXjssce45ppr2GOPPXped911FytWrGCXXXbh6quv5l/+5V/Ye++9Oe64\n43jkkUc2Of6vf/1r9t133422DeXO7ptvvpnDDz+cvfbaiz322IObbrqJZ555ZpNyr3vd65g/fz7t\n7e20tLRw6qmn8tRTTw2xNTbV0tLSs7zzzjvzwgsvALW2ueeeezZqmyuuuIKuri4A7rnnHo488khe\n/epXM2nSJL7+9a9vUu/hvsN9IAa2JI0y7373uzn77LP59Kc/DcC0adM444wzWLVqVc/r+eef51Of\n+hQAxxxzDAsXLmTFihUceOCBfPSjH93kmHvvvTePP/54z3pmbrQ+YcIEXnrppZ71FStW9CyvWbOG\nE088kU996lOsXLmSVatWMWvWrAF75aeeeip33nknjz32GBHR8330Z0tvOps2bRpHHHHEJm1z8cUX\nA/ChD32I2bNn88QTT9Dd3c3HPvaxnuvyw1WHRhnYkjQKzZ07lyVLlnDPPfdw+umn84Mf/ICFCxfy\nu9/9jpdffpmOjg6efPJJVq5cyXXXXceLL77I9ttvz6677sr48eM3Od6sWbNYtmwZ3//+93nllVe4\n6KKLNgrlGTNmcMcdd/D444/z3HPPcf755/fsW7t2LWvXrmXy5MmMGzeOm2++mYULF/Zb7+XLl3P7\n7bezZs0adtxxR3baaad+6wO1PxpeeeUVXn755Z7XunXr+i03kPe9730sX76cyy+/nHXr1rFu3Tp+\n8pOf8PDDDwPwwgsvsMcee7DDDjuwZMkSrrjiihG7M93AlqRRaPLkycyZM6fnjuvrrruOL3zhC7z6\n1a9m2rRpfPnLXyYzWb9+PV/5ylfYZ5992Guvvbjzzjv52te+Bmz82NTkyZO55pprOOecc5g8eTKP\nPvoo73znO3vON3PmTE4++WQOOeQQ3vrWt/L+97+/57277bYbF110ESeddBJ77rknV155JR/4wAc2\nqu+GsmvWrOHcc8/lVa96FVOnTuXpp5/eKPz7vueCCy5gl1126Xm95z3v6bdc35DtXbeFCxdy1VVX\nsc8++zB16lTOPfdc1q5dC8BXv/pVzjvvPCZOnMjnP/95Tj755H6PszX4ediS1IDq84s32rYtTZyi\nbVN//296bR9S2hvYktSAgX7xSoMZzsB2SFySpAI4NanURyPDnA5VStraDGypj0bmhx7KHM+SNBwc\nEpckqQAGtiRJBTCwJUkqgNewJalB29JnL2vsMbAlqQE+g62R5pC4JEkFMLAlSSqAgS1JUgEMbEmS\nClA3sCPiDyLivl6v5yLiryJiz4hYFBHLI2JhREzaGhWWJGksqhvYmflIZh6amYcCfwi8BHwfOA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AdcB3gGlAJ3BSZtb5QEbVU92h\nfAfwM35/qedcan/Y297DLCLeRO2msnHV67LM/IeI2JMhtLcTp0iSVACfzZUkqQAGtiRJBTCwJUkq\ngIEtSVIBDGxJkgpgYEuSVAADW5KkAhjYkiQV4P8D6ozDoP/R7QEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x79d3e48>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "from matplotlib import pyplot as plt\n",
    "f, ax = plt.subplots(figsize=(7, 5))\n",
    "f.tight_layout()\n",
    "ax.hist(boston.target - predictions,bins=40, label='Residuals Linear', color='b', alpha=.5);\n",
    "ax.set_title(\"Histogram of Residuals\")\n",
    "ax.legend(loc='best');"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "如果你用IPython Notebook，就用`%matplotlib inline`命令在网页中显示matplotlib图形。如果你不用，就用`f.savefig('myfig.png')`保存图形，以备使用。\n",
    "\n",
    ">画图的库是[matplotlib](http://matplotlib.org/)，并非本书重点，但是可视化效果非常好。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "和之前介绍的一样，误差项服从均值为0的正态分布。残差就是误差，所以这个图也应噶近似正态分布。看起来拟合挺好的，只是有点偏。我们计算一下残差的均值，应该很接近0："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6.0382090193051989e-16"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "np.mean(boston.target - predictions)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "另一个值得看的图是**Q-Q图（分位数概率分布）**，我们用Scipy来实现图形，因为它内置这个概率分布图的方法："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
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+gxAnwHoM6irlE5Z2F1m5i2x3CIi0njMDG+uA1lERESamkJPRETShkJPRETS\nhkJPRETShkJPRETShkJPRETShkJPRETShkJPRETShkJPRETShkJPRETShkJPRETShkJPRETShkJP\nRERatMLCYk488Zd1Ole7LIiISItVWFjMVVfNYsmS2wDtsiAiIq3Y3XfPjgKvbhR6IiLSYpWWZtbr\nfIWeiIi0WO3bb6/X+Qo9ERFpscaPH0Vu7oQ6n1+/eqGIiEgSFBYWc/fdsyktzaR9++2MHz+K0aOH\n1fs+sWvuuedGZs3a9fkavSkiIk2q8ojLIDd3AhMnnrhbwRdjptGbIiLSzNQ04nLJktu45545jf7e\nCj0REWlStY24LCnJaPT3VuiJiEiTqm3EZVZWeaO/t0JPRESaVE0jLnNzb2DcuJGN/t4ayCIiIklT\n11GZhYXF3HPPHEpKMsjKKmfcuJENGsQCdRvIotATEZGkaKxRmXWl0ZsiItJkUjkqs64UeiIikhSp\nHJVZVwo9ERFJilSOyqwrhZ6IiCRFKkdl1pUGsoiISNI0xqjMutLoTRERSRsavSkiIpJAoSciImlD\noSciImlDoSciImlDoSciImlDoSciImlDoSciImlDoSciImlDoSciImlDoSciImlDoSciImlDoSci\nImlDoSciImkjZaFnZnub2fNm9p6ZvWtm46Pj3c1sjpl9aGazzaxrqsooIiKtS8q2FjKzXkAvd3/L\nzDoCbwA/BMYCX7j7b83sWqCbu19X5VptLSQiIpU0662F3H2Vu78VPd4ELAT6AqcCU6LTphCCUERE\npMGaRZ+emQ0EhgLzgL3cfXX00mpgrxQVS0REWpmUh17UtPkYcJW7b0x8LWrDVDumiIgkRWYq39zM\n2hIC7wF3fzI6vNrMern7KjPrDayp6dr8/Pwdj0eMGMGIESMaubQiItKcFBUVUVRUVK9rUjmQxQh9\nduvc/WcJx38bHbvTzK4Dumogi4iI7EpdBrKkMvSOBYqBt4k3YV4PvAY8DPQHPgXOcfevqlyr0BMR\nkUqadeg1hEJPRESqatZTFkRERJqaQk9ERNKGQk9ERNKGQk9ERNK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q1urVr4dJLYd482Gef\nVJdMRESagZbfp1deDv/8Zwi6Z58Ng1HGjoUTTtBCzyIiaaR1D2RZsgQmTw5fPXqE5ssxY6B791QX\nT0Ragfnz57N582bmzZvHNddck+riSB3UJfRa7vIi3/oWbNgQBqm88QZceaUCT0SSZv78+XzrW9/i\niy++YNOmTakujiRJy+3TW74c2rdPdSlEpJX6yU9+Qnl5Odu3b6ejNn5uNVpu82YLLLeINE+33347\nkyZN4tprr2XTpk188MEH/OEPf+CJJ55g1KhRdOnShba7uXDFr3/9aw499FDeffddbrjhhkqvVVRU\nMH36dLKzs1m1ahVXXHEF5eXl3HnnnQwcOJDNmzdz+eWX13jeru6djlp386aISJIcddRRnHHGGfzo\nRz/ipz/9KatWreK+++5j7ty5XH/99bTZzYXmn3vuOdydU089lbKyMl588cVKr8+cOZODDz6YM844\ng169erFgwQKmT59O//79Of/881m8eDGfffZZjeft6t5SM4WeiKS9efPmMXz4cABWr17NunXruPDC\nC7n//vu57777yNjNkeAvv/wyhx9+OABDhw7ln//8Z6XXO3XqxE033cSmTZtYuXIlgwYN4uWXX6Zf\nv34ADBgwgBdffLHW83Z2b6mZQk9E0t78+fMpKSnhT3/6E3fddRezZs2iexIGxq1Zs4acaEGMDh06\nsGrVqkqvH3fccXTv3p2DDz6YDh060LVrVzp27EhZWRkQmj9XrFhR43m7urfUrOUOZBERSZJ169Zx\nxhlnADB8+HDatWtXp+vef/995syZU+Nrl1xyCRUVFTtqieXl5dVqjJ9//jnf/va3OfbYY/nVr37F\nyJEjufDCC3nxxRcZOXIk77zzDvvttx+rVq2qdt6u7i01U+iJSFpbunQpvXr12vH8s88+Y9u2bWRn\nZ+/y2sGDBzN4J9uQ7bXXXmzevBmADRs20KNHj0qv/+1vf+OGG24gIyODQYMGMWPGDH7+85/z5Zdf\n8uyzz9K3b18OOugg7rvvvmrn7ereUjOFnoiktXnz5nHooYcCUFpaysqVK8nOzmbNmjX07Nlzp9fu\nrKZ38cUXc+yxx/L666/z/e9/n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8DMzW2Bmx0bn/DyhHBZdf4SZFZnZfDObGe3HhpmNjzYi/Xe00olIq9OsF5wWaSUO\nImzsuYO7b4y2xcqocm5ijWyCu6+PNox9zswOdvd3o9fXuvsRZvafhM0yLzezPwMb3f0PAGZ2ApVr\ndx41qd4DnOLu68zsXEKN8zLgWmCgu5eZWedkfgAizYVCT6Tx7axZcWf9euea2eWE39PewGDg3ei1\nx6PvbwJnJFxTddFtq/J4f0IIPxdaXckAVkavvw08ZGZPAmm9Ur+0Xgo9kcb3PnBW4oGoJrU3sBb4\nRsJLWdHrg4CfA0dGW6VMir0WKY2+l7Pz3+OaAvc9d/92DcdHA8OAUwj7VA5x9/Kd3FukxVGfnkgj\nc/e5QI6ZXQQQNVf+nrAP5CeEjS/NzPYGjoou6wRsBjaY2V5AXXaO2BhdlyixpufAB0APMzs6Kktb\nMxscDbbpH226eR3QBehQ7x9WpJlTTU+kaZwO/NHMbgR6ALOBK6L+s08ItcGFRH1/7v62mS0AFgHL\ngJdquW9iH+DTwKNmdiowPuH1+Mnh/c4C7o52mM4E/gf4EHggOmbARHffkISfW6RZ0dZCIk0smkt3\nH3C2uy9MdXlE0olCT0RE0ob69EREJG0o9EREJG0o9EREJG0o9EREJG0o9EREJG0o9EREJG0o9ERE\nJG38f+BmLBAmYNB0AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x79d3908>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from scipy.stats import probplot\n",
    "f = plt.figure(figsize=(7, 5))\n",
    "ax = f.add_subplot(111)\n",
    "probplot(boston.target - predictions, plot=ax);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "这个图里面倾斜的数据比之前看的要更清楚一些。\n",
    "\n",
    "我们还可以观察拟合其他量度，最常用的还有均方误差（mean squared error，MSE），平均绝对误差（mean absolute deviation，MAD）。让我们用Python实现这两个量度。后面我们用scikit-learn内置的量度来评估回归模型的效果："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def MSE(target, predictions):\n",
    "    squared_deviation = np.power(target - predictions, 2)\n",
    "    return np.mean(squared_deviation)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "21.897779217687496"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "MSE(boston.target, predictions)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def MAD(target, predictions):\n",
    "    absolute_deviation = np.abs(target - predictions)\n",
    "    return np.mean(absolute_deviation)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3.2729446379969396"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "MAD(boston.target, predictions)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##How it works..."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "MSE的计算公式是：\n",
    "\n",
    "$$E(\\hat y_t - y_i)^2$$\n",
    "\n",
    "计算预测值与实际值的差，平方之后再求平均值。这其实就是我们寻找最佳相关系数时是目标。高斯－马尔可夫定理（Gauss-Markov theorem）实际上已经证明了线性回归的回归系数的最佳线性无偏估计（BLUE）就是最小均方误差的无偏估计（条件是误差变量不相关，0均值，同方差）。在**用岭回归弥补线性回归的不足**主题中，我们会看到，当我们的相关系数是有偏估计时会发生什么。\n",
    "\n",
    "MAD是平均绝对误差，计算公式为：\n",
    "\n",
    "$$E|\\hat y_t - y_i|$$\n",
    "\n",
    "线性回归的时候MAD通常不用，但是值得一看。为什么呢？可以看到每个量度的情况，还可以判断哪个量度更重要。例如，用MSE，较大的误差会获得更大的惩罚，因为平方把它放大。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "###There's more..."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "还有一点需要说明，那就是相关系数是随机变量，因此它们是有分布的。让我们用bootstrapping（重复试验）来看看犯罪率的相关系数的分布情况。bootstrapping是一种学习参数估计不确定性的常用手段："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "n_bootstraps = 1000\n",
    "len_boston = len(boston.target)\n",
    "subsample_size = np.int(0.5*len_boston)\n",
    "subsample = lambda: np.random.choice(np.arange(0, len_boston),size=subsample_size)\n",
    "coefs = np.ones(n_bootstraps) #相关系数初始值设为1\n",
    "for i in range(n_bootstraps):\n",
    "    subsample_idx = subsample()\n",
    "    subsample_X = boston.data[subsample_idx]\n",
    "    subsample_y = boston.target[subsample_idx]\n",
    "    lr.fit(subsample_X, subsample_y)\n",
    "    coefs[i] = lr.coef_[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们可以看到这个相关系数的分布直方图："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbEAAAFCCAYAAAB/1uMGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAG6ZJREFUeJzt3X+QZWdd5/H3xwwhQiBDDDX5iY1AlCggKL9UpFeCG1CT\nrOsiKJqBSFmyCqMiEtgyPZYLBEXGXdQqfkRG1gQjYCooaAak3YyQtEAmkEwwxK2GBJyJkHQgQpiE\nfPePeya503371+3b3fP0vF9VU33uc37c79M9fT/3ec65p1NVSJLUom9b7wIkSRqWISZJapYhJklq\nliEmSWqWISZJapYhJklqliGmVZHk+iQ/ut51rKck/yXJLUm+luR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nbtPJCuJT+tWy5/Tsf+OCqVjRaS+pf\nknOT3Ah8CFjw9MRIrk5MsovelNJsr+t/UFU16HNiSX4SuK2qrk0yPoqaRmml/evW3Qd8f5LjgL9P\nMl5VkyMvdgij6F93nGOB9wKv7EZkh4VR9a8RS61/9mxHK/1upc5hLbl/Sf4T8FLgh1evnJFbUv+q\n6nLg8iTPAt4NfPd8244kxKrqufOt606Gn1hV+5KcBNw2YLMfAs5O8nzgGODhSf68qn5xFPWt1Aj6\n13+sO5P8Lb05+8nRVjqcUfQvyYOA9wH/p/sPeNgY5c+vAV8ETut7fBq9d7sLbXNq19aCpfSvZUvq\nX3cxx9uBs6qqhWnug5b186uqq5JsSvIdVfWVQdusxXTiFcB53fJ5wJwXuKp6bVWdVlWPBl4I/MPh\nEmBLsGj/kpxw8Kq3JN8OPBe4ds0qXJml9C/AO4G9VbVjDWsbhUX715hPAI9LMpbkaOBn6fWx3xXA\nL8L9d9mZ6ZtSPdwtpX8HtXRu/aBF+5fkUcD7gRdX1c3rUONKLKV/j+leU0jyFID5Aoxu5WpfjXI8\n8GHgJuBKYHPXfjLwtwO2fzZtXZ24aP+AJwKfonclzqeB31rvukfcvx+hdy5zD71wvpbeO8R1r38U\n/eseX0rvLjTfpDen/5L1rn2BPj2P3hWiNwMXdG2/DPxy3zZv7dZfBzxlvWseZf/oTR3fAtxJ72Kc\nLwDHrnfdI+zfO4Cv9P2uTa13zSPu36uB67u+XQU8daHj+WFnSVKz1mI6UZKkVWGISZKaZYhJkppl\niEmSmmWISZKaZYhJkppliEmSmmWISZKa9f8BuMyB15zUaVEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xb51128>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "f = plt.figure(figsize=(7, 5))\n",
    "ax = f.add_subplot(111)\n",
    "ax.hist(coefs, bins=50, color='b', alpha=.5)\n",
    "ax.set_title(\"Histogram of the lr.coef_[0].\");"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们还想看看重复试验后的置信区间："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-0.18030624,  0.03816062])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.percentile(coefs, [2.5, 97.5])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "置信区间的范围表面犯罪率其实不影响房价，因为0在置信区间里面，表面犯罪率可能与房价无关。\n",
    "\n",
    "值得一提的是，bootstrapping可以获得更好的相关系数估计值，因为使用bootstrapping方法的均值，会比普通估计方法更快地**收敛（converge）**到真实均值。"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
